﻿using System;
namespace Producers.Etoimik.Xtee.Riik.Ee.Producer.Etoimik {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="SeotudMenetlus", Namespace="http://producers.etoimik.xtee.riik.ee/producer/etoimik", Target=typeof(SeotudMenetlus))]
    public class SeotudMenetlusSerializer : global::Producers.Etoimik.Xtee.Riik.Ee.Producer.Etoimik.MenetlusSerializer {
        
        public SeotudMenetlusSerializer(ISeotudMenetlus clazz) : 
                base(clazz) {
        }
        
        protected new ISeotudMenetlus clazz {
            get {
                return ((ISeotudMenetlus)(base.clazz));
            }
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            if (clazz.SidumiseKP!=null) {
                Writer.WriteStartElement("SidumiseKP");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "dateTime");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDateTime(((System.DateTime)(clazz.SidumiseKP))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.SidumiseAlusKL!=null) {
                Writer.WriteStartElement("SidumiseAlusKL");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.SidumiseAlusKL))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.MenetlejadCSV!=null) {
                Writer.WriteStartElement("MenetlejadCSV");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.MenetlejadCSV))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.Peaasi!=null) {
                Writer.WriteStartElement("Peaasi");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "boolean");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdBoolean(((bool)(clazz.Peaasi))).ToString());
                Writer.WriteEndElement();
            }
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
            if (Reader.LocalName=="SidumiseKP") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.SidumiseKP = new global::Xtee.Core.Schema.XsdDateTime(Reader.ReadElementString("SidumiseKP")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="SidumiseAlusKL") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.SidumiseAlusKL = new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("SidumiseAlusKL")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="MenetlejadCSV") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.MenetlejadCSV = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("MenetlejadCSV")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="Peaasi") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Peaasi = new global::Xtee.Core.Schema.XsdBoolean(Reader.ReadElementString("Peaasi")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
        }
    }
}
